#include "StdAfx.h"
#include "WEBattery.h"

#define BATTERY_TIMER_ID  1
#define BATTERY_TIMER_LEN 1000

CWEBattery::CWEBattery(void)
{
	m_nStyleIndex = 0;
}

CWEBattery::~CWEBattery(void)
{
}


void CWEBattery::OnInitLayer()
{
	TCHAR szStyle[64] = {0};
	_stprintf(szStyle, L"battery%d", m_nStyleIndex);
	SetStyle(szStyle);
	SetTimer(BATTERY_TIMER_ID, BATTERY_TIMER_LEN);
}

void CWEBattery::OnTimer(WORD wIDEvent)
{
	if (BATTERY_TIMER_ID == wIDEvent)
	{
		m_nStyleIndex++;
		if (4 == m_nStyleIndex)
		{
			m_nStyleIndex = 0;
		}
		TCHAR szStyle[64] = {0};
		_stprintf(szStyle, L"battery%d", m_nStyleIndex);
		SetStyle(szStyle);
	}
}